<template>
  <el-cascader
    :options="selectOptions"
    v-bind="$attrs"
    :value="value"
    :props="{ checkStrictly: false }"
    clearable
    filterable
    v-on="$listeners"
  />
</template>

<script>
import { options } from "./constant.js"

export default {
  name: "SampleStatusSelect",
  model: {
    prop: "value",
    event: "change"
  },

  props: {
    value: {
      type: [String, Number, Array, Boolean],
      default: 1
    },

    handleOptions: {
      type: Function
    },

    type: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      selectOptions: options
    }
  },
  watch: {
    type: {
      immediate: true,
      handler(val) {
        if (val) {
          this.selectOptions = options.filter((v) => v.value === val)
        } else {
          this.selectOptions = options
        }
      }
    }
  },
  mounted() {
    // console.log(options, '[[options]]')
  },
  methods: {
    // changes:function(val){
    //   setTimeout(() => {
    //     this.$emit('change', val[val.length - 1]);
    //   },100)
    // }
  }
}
</script>
